<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

define("SUCCESS_CODE",200);
define("FAIL_CODE",-1);
define("LOGIN_OUT_CODE",-2);
define("UN_ACCESS",-3);


// 返回成功
function returnSuccess($data = [], $msg = '')
{

    $result = [
        'code' => SUCCESS_CODE,
        'status' => true,
        'data' => $data,
        "msg" => $msg
    ];
    return json($result);
}

// 返回失败
function returnFail($msg = '')
{
    $result = [
        'code' => FAIL_CODE,
        'status' => false,
        'data' => [],
        "msg" => $msg
    ];
    return json($result);
}

function returnJson($code,$data,$msg)
{
    $result = [
        'code' => $code,
        'status' => false,
        'data' => $data,
        "msg" => $msg
    ];
    return json($result);
}